<%@ page contentType="text/html;charset=UTF-8" language="java" %>
    <html>

    <head>
        <meta charset="UTF-8">
        <title>添加菜品</title>
        <link rel="stylesheet" href="../css/amazeui.min.css" />
        <link rel="stylesheet" href="../css/admin.css" />

        <script type="text/javascript" src="../js/picture.js"></script>
    </head>

    <body>
    <div class="am-cf am-padding am-padding-bottom-0">
        <div class="am-fl am-cf">
            <strong class="am-text-primary am-text-lg">添加菜品</strong>
        </div>
        <br />
        <hr />
        </div>
    <form action="/fullboy/addFood.action" method="post" target="_parent">
    <table>
        <tr>
            <td>菜品名称：<input type="text" name="food_name" id="food_name" style="width: 200px;height: 36px;" placeholder="请输入菜品名称"></td>
        </tr>
        <tr>
            <td>菜品类型：
                <select id="sel" name="mySel">
                    <option>---请选择菜品类型---</option>
                </select>
            </td>
        </tr>
        <tr>
            <td>菜品价格：<input type="text" name="food_price" id="food_price" style="width: 200px;height: 36px;" placeholder="请输入菜品价格"></td>
        </tr>
        <tr>
            <td>菜品简介：<textarea name="food_remark" rows="5"  id="food_remark" cols="40"></textarea></td>
        </tr>
        <tr>
                  <td>  选择图片：
                    <span style="line-height:20px;"><input type="file" name="file" onchange="imgPreview(this)" /></span></td>
                    <td><img id="preview" style="width: 170px; height: 170px;" /></td>
        </tr>
        <tr>
                   <td><input type="submit" name="add_food" id="add_food" class="am-btn am-btn-default" value="提交" /></td>
        </tr>
    </table>
    </form>
    </body>

    <script type="text/javascript" src="../js/jquery.min.js" ></script>
    <script type="text/javascript" src="../js/judgment.js"></script>
    <script type="text/javascript" src="../js/jquery-1.4.1.js"></script>
    <script type="text/javascript">
        $(document).ready(function(){
            $.ajax({
                url:"/fullboy/queryTypes.action",
                type: "POST",
                cache: false,
                dataType: "json",
                success:function (data) {
                    console.log(data);
                    if(data.success){
                        var types = data.data;
                        for(var i = 0; i<types.length;i++){
                            $("#sel").append("<option value='"+types[i].dTypeId+"'>"+""+types[i].dTypeName+"</option>");
                        }
                    }

                }
            });
        });
    </script>
    </html>
